import React from 'react';
import logo from './logo.svg';
import './App.css';
import js_xlsx_aoa from './js-xlsx/aoa';
import js_xlsx_jaon from './js-xlsx/json';
import xlsx_populate_1 from './xlsx-populate/exp1';
import exportor from './xlsx-populate/exportor';

function App() {
  return (
    <div className="App">
      <header className="App-header">
        <img src={logo} className="App-logo" alt="logo" />
        <button className="export-btn" onClick={js_xlsx_aoa}>aoa</button>
        <button className="export-btn" onClick={js_xlsx_jaon}>json</button>
        <br/>
        <button className="export-btn" onClick={xlsx_populate_1}>exp1</button>
        <button className="export-btn" onClick={() => {
          let e = new exportor();
          e.init({ sheets: [{
            name: 'Sheet1',
            columns: [
              { name: '时间', width: 25, type: 'DateTime' },
              { name: '颜色', width: 25, type: 'String' },
              { name: '名称', width: 25, type: 'String' },
              { name: '数量', width: 25, type: 'Number' },
            ],
            rows: [
              [ new Date('2019-7-03'), '红色', '棒子', 34 ],
              [ new Date('2019-8-15'), '黄色', '棒子', 23 ],
              [ new Date('2019-8-18'), '绿色', '老虎', 19 ],
              [ new Date('2019-8-22'), '蓝色', '鸡', 67 ],
            ]
          }] }, 'Test').then(e => {
            e.export();
          });
        }}>exp2</button>
      </header>
    </div>
  );
}

export default App;
